package com.example.inventoryservice.WarehouseQueryDemo;


import java.util.ArrayList;
import java.util.List;

// 按库存组织过滤的具体策略
public class InventoryOrgFilterStrategy  implements WarehouseFilterStrategy  {
    @Override
    public List<Warehouse> filter(List<Warehouse> allWarehouses, String inventoryOrg, String accountingEntity) {
        List<Warehouse> result = new ArrayList<>();
        for (Warehouse warehouse : allWarehouses) {
            // 只过滤出匹配指定库存组织的仓库
            if (inventoryOrg.equals(warehouse.getInventoryOrg())) {
                result.add(warehouse);
            }
        }
        return result;
    }
}
